package Threa;

public class RunnTest  implements  Runnable{
   private int toltal=1000;
   int counm=0;
    @Override
    public void run() {
        while(true){
            counm +=10;
            if (toltal<=200){
                break;
            }
            Runn();
            return;
        }

    }
public synchronized void Runn(){
    System.out.println(Thread.currentThread().getName()+"下一个");
        for (int i=10;i<=100;i+=10){
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+"跑了"+i+"m");
        }
        toltal -=100;
}

    public static void main(String[] args){
        RunnTest  rt=new RunnTest();
        for (int i=1;i<=10;i++){
            Thread player=new Thread(rt,(i+1)+"号选手");
            player.start();
        }
//
//        Thread player1=new Thread(rt,"1号选手");
//        player1.start();
//
//        Thread player2 = new Thread(rt, "2号选手");
//        player2.start();
//
//        Thread player3 = new Thread(rt, "3号选手");
//        player3.start();
    }
}
